package com.example.wxordersystem.service.impl;
import com.example.wxordersystem.entity.ProductCategory;
import com.example.wxordersystem.mapper.CategoryMapper;
import com.example.wxordersystem.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 常红伟 类别
 */
@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    CategoryMapper categoryMapper ;

    @Override
    public ProductCategory findOne(Integer categoryId) {
        ProductCategory category =categoryMapper.selectById(categoryId);
        return category;
    }

    @Override
    public List<ProductCategory> findAll() {
        List<ProductCategory>list =categoryMapper.selectList(null);
        return list;
    }

    @Override
    public int save(ProductCategory productCategory) {

        return this.categoryMapper.insert(productCategory);
    }

    @Override
    public int update(ProductCategory productCategory) {
        return this.categoryMapper.updateById(productCategory);
    }


}
